<?php
declare(strict_types=1);

namespace app\common\lib;

class ClassArray
{
    public static function smsClassStat(): array
    {
        return [
            'ali' => 'app\common\lib\sms\AliSms'
        ];
    }

    public static function initClass(string $type, string $class, array $param = [], bool $needInstance = false)
    {
        $classArr = self::$class();
        if (!array_key_exists($type, $classArr)) return false;
        $className = $classArr[$type];
        return $needInstance == true ? (new \ReflectionClass($className))->newInstanceArgs($param) : $className;
    }
}